/*
 * ProductBO.java
 *
 * Created on March 29, 2007, 1:11 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

//package edu.byu.isys413.pb88.data;
package finalintex2web;
import java.util.LinkedList;
import java.util.List;

/**
 *
 * @author Owner
 *This class is an abstract class and is inherited by Physical Product and Conceptual ProductDAO
 */
public abstract class ProductBO 
{
    
      private String id = null, type = null; 
      private double price = 0;
      private boolean indb = false , dirty = false;
      private List<SaleBO> sales = new LinkedList();  
      private String description;
   
    
    /** Creates a new instance of ProductBO*/
   public ProductBO(String id) 
   {
        this.setId(id);
   }
    
   /*This method gets the id for the product object
    *returns id
    *
    */ 
   public String getId() {
        return id;
    }

    //This method sets the id for the product object 
    public void setId(String id) 
    {
        this.id = id;
        this.setDirty(true);
    }

    /**
     * @return boolean indb 
     * This method is to check if this object is already set in the database or not.
     *
     */
    public boolean isIndb() 
    {
        return indb;
    }

    /**
     * @param indb
     * Sets the indb variable to whatever is passed in indb.
     *This method is to tell the object that this object has already been saved or not saved in the database. 
     */
    public void setIndb(boolean indb) {
        this.indb = indb;
    }

    /**
     * This method enables us to know if the object is dirty. If the object is dirty then we need to update it in the database.
     *If the object is not dirty then we dont need to update the object in the database.
     * @return 
     */
    public boolean isDirty() 
    {
        return dirty;
    }

    /**
     * 
     * @param dirty 
     * Sets the object as dirty or not dirty depending on the parameter passed.
     */
    public void setDirty(boolean dirty) {
        this.dirty = dirty;
    }

    /*This method returns price of the the product.
     *@return price
     */
    public double getPrice() {
        return price;
        
    }

    /*
     * @param price 
     *This method sets the price for the product.
     */
    public void setPrice(double price) {
        this.price = price;
        this.setDirty(true);
    }

    public List<SaleBO> getSales() {
        return sales;
    }

    public void setSales(List<SaleBO> sales) {
        this.sales = sales;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }
    
}
